import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue' //首页
import inventoryView from '../views/inventoryView.vue' //库存管理
import OrderView from '../views/OrderView.vue' //订单管理
import UserView from '../views/UserView.vue' //用户管理
import GoodsView from '../views/GoodsView.vue' //商品管理
import LoginView from '../views/LoginView.vue' //登录页
import LayoutView from '../views/LayoutView.vue' //首页
const router = createRouter({
        history: createWebHistory(import.meta.env.BASE_URL),
        routes: [
            {
                path: '/',
                component: HomeView, //首页
                redirect: '/layout', //重定向首页
                children: [
                    {
                        path: '/layout',
                        component: LayoutView
                    },
                    {
                        path: '/goods',
                        component: GoodsView,//商品管理
                    },
                    {
                        path: '/inventory',
                        component: inventoryView,//库存管理
                    },
                    {
                        path: '/order',
                        component: OrderView,//订单管理
                    }, {
                        path: '/user',
                        component: UserView,//用户管理
                    },

                ]
            },
            {
                path: '/login',
                component: LoginView
            }
        ]
    }
)

export default router
